﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="town.ascx.cs" Inherits="town" %>
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
    GroupItemCount="3">
    <AlternatingItemTemplate>
        <td id="Td1" runat="server" style="background-color:#151613;" width="210px" heiht="30px">
           <a href='<%= Request.Url.ToString() %>&TownID=<%# Eval("TownID") %>'>
               <img src="images/town.png" alt="TAXI"/>
                <!--
                <asp:Label ID="TownIDLabel" runat="server" Text='<%# Eval("TownID") %>' 
                ForeColor="Yellow" Font-Size="32px" Font-Bold="True"/>
                -->
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' ForeColor="#F0F0F0" Font-Size="18px"/>
            </a> 
            <br />
            <br />
        </td>
    </AlternatingItemTemplate>
    <EditItemTemplate>
        <td id="Td2" runat="server" style="background-color:#FFCC66; color: #000080;">
            
           
            Name:
            
           
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            TownID:
            <asp:Label ID="TownIDLabel1" runat="server" Text='<%# Eval("TownID") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
            <br />
        </td>
    </EditItemTemplate>
    <EmptyDataTemplate>
        <table id="Table1" runat="server"             
            style="background-color: #151613;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
            <tr>
                <td>
                    No town returned.</td>
            </tr>
        </table>
    </EmptyDataTemplate>
    <EmptyItemTemplate>
        <td id="Td3" runat="server" style="background-color:#151613;" width="210px" heiht="30px" />
    </EmptyItemTemplate>
    <GroupTemplate>
        <tr ID="itemPlaceholderContainer" runat="server">
            <td ID="itemPlaceholder" runat="server">
            </td>
        </tr>
    </GroupTemplate>
    <InsertItemTemplate>
        <td id="Td4" runat="server" style="">
            
            
            Name:           
            
            <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
            <br />
            TownID:
            <asp:TextBox ID="TownIDTextBox" runat="server" Text='<%# Bind("TownID") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br />
        </td>
    </InsertItemTemplate>
    <ItemTemplate>
        <td id="Td5" runat="server" style="background-color:#151613;" width="210px" heiht="30px" border="0">
           
           <a href='<%= Request.Url.ToString() %>&TownID=<%# Eval("TownID") %>'>
                <!--
                <asp:Label ID="CityIDLabel" runat="server" Text='<%# Eval("TownID") %>' ForeColor="Yellow" Font-Size="32px" Font-Bold="True" />
                -->
               <img src="images/town.png" alt="TAXI"/>
                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>'  ForeColor="#F0F0F0"  Font-Size="18px" />
           </a> 

            <br />
            <br />
        </td>
    </ItemTemplate>
    <LayoutTemplate>
        <table id="Table2" runat="server" border="0">
            <tr id="Tr1" runat="server">
                <td id="Td6" runat="server">
                    <table ID="groupPlaceholderContainer" runat="server" border="0"  width="630px"
                        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;font-family: Verdana, Arial, Helvetica, sans-serif;">
                        <tr ID="groupPlaceholder" runat="server">
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="Tr2" runat="server">
                <td id="Td7" runat="server" 
                style="text-align: center;background-color: #151613; 
                font-family: Verdana, Arial, Helvetica, sans-serif;color:Yellow;
                text-decoration:none;">
                    <asp:DataPager ID="DataPager1" runat="server" PageSize="27">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="True" FirstPageText="<<<" PreviousPageText="<" />
                            <asp:NumericPagerField NextPageText=">" PreviousPageText="<"/>
                            <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" 
                                ShowNextPageButton="True" ShowPreviousPageButton="False" LastPageText=">>>" NextPageText=">" />
                        </Fields>
                    </asp:DataPager>
                </td>
            </tr>
        </table>
    </LayoutTemplate>
    <SelectedItemTemplate>
        <td id="Td8" runat="server" 
            style="background-color:#FFCC66; font-weight: bold;color: #000080;">
            <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
            <br />
            TownID:
            <asp:Label ID="TownIDLabel" runat="server" Text='<%# Eval("TownID") %>' />
            <br />
        </td>
    </SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    SelectCommand="SELECT dbo.Town.Name, dbo.Town.TownID FROM dbo.City INNER JOIN dbo.Town ON dbo.City.CityID = dbo.Town.CityID WHERE (dbo.Town.CityID = @CityID)">
    <SelectParameters>
        <asp:QueryStringParameter Name="CityID" QueryStringField="CityID" 
            DefaultValue="35" />
    </SelectParameters>
</asp:SqlDataSource>

